package com.nanhai.buddhist.college.module.collegebase.dal.mysql.accommodationbuilding;

import java.util.*;

import com.nanhai.buddhist.college.framework.common.pojo.PageResult;
import com.nanhai.buddhist.college.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.nanhai.buddhist.college.framework.mybatis.core.mapper.BaseMapperX;
import com.nanhai.buddhist.college.module.collegebase.dal.dataobject.accommodationbuilding.AccommodationBuildingDO;
import org.apache.ibatis.annotations.Mapper;
import com.nanhai.buddhist.college.module.collegebase.controller.admin.accommodationbuilding.vo.*;

/**
 * 楼栋管理 Mapper
 *
 * @author AKai
 */
@Mapper
public interface AccommodationBuildingMapper extends BaseMapperX<AccommodationBuildingDO> {

    default PageResult<AccommodationBuildingDO> selectPage(AccommodationBuildingPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<AccommodationBuildingDO>()
                .eqIfPresent(AccommodationBuildingDO::getSerialNumber, reqVO.getSerialNumber())
                .likeIfPresent(AccommodationBuildingDO::getBuildingName, reqVO.getBuildingName())
                .orderByDesc(AccommodationBuildingDO::getCreateTime));
    }

    default List<AccommodationBuildingDO> selectList(AccommodationBuildingExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<AccommodationBuildingDO>()
                .eqIfPresent(AccommodationBuildingDO::getSerialNumber, reqVO.getSerialNumber())
                .likeIfPresent(AccommodationBuildingDO::getBuildingName, reqVO.getBuildingName())
                .orderByDesc(AccommodationBuildingDO::getCreateTime));
    }

}
